
M	EQU	Byte Ptr 0[BX]
	TITLE	'92A OKIDATA PRINTER UTILITY          12 MARCH 84'
;
;	USE ASM86.CMD TO ASSEMBLE 
;	THEN    GENCMD OKI-92 8080
;       
;
; GENERAL EQU'S
;
BDOS	EQU	224			;SYSTEM CALL INTERUPT VECTOR
CONIN	EQU	1			;GET KEYBOARD CHARACTER
CR	EQU	0DH			;CONTROL-M FOR CARRIAGE RETURN
CONOUT	EQU	2			;CRT OUTPUT ROUTINE
CTLC	EQU	3			;CONTROL-C TO TERMINATE
ESC	EQU	1BH			;ESCAPE CHARACTER
LF	EQU	0AH			;CONTROL-J FOR LINE FEED
LST	EQU	5			;LIST DEVICE OUTPUT
STRING	EQU	9			;PRINT STRING ON CONSOLE
TAB	EQU	09H			;CONTROL-I FOR HORIZONTAOL TAB
CLEAR	EQU	1AH			;CLEAR SCREEN COMMAND
;
	ORG	100H
;
	JMP	START			;JUMP INTO PROGRAM
L_1	EQU	$
	DSEG
	ORG	Offset L_1
;
; DATA STRINGS TO CONTROL OKIDATA 92A PRINTER
;
CPI5	DB	30,31,0			;5 CPI   DOUBLE PRINT 
CPI6	DB	28,31,ESC,'6',0		;6 CPI   DOUBLE PRINT       
CPI8	DB	29,31,ESC,'6',0		;8.5 CPI DOUBLE PRINT 	
PRTSEL	DB	17,ESC,'0'		;SELECT PRINTER	
CPI10	DB	30,ESC,'6',0		;10 CPI, NORMAL
CPI12	DB	28,ESC,'6',0		;12 CPI, NORMAL
CPI17	DB	29,ESC,'6',0		;17 CPI, NORMAL
CORA	DB	ESC,'1',0		;CORESPONDENCE PRINT
DATAP	DB	ESC,'0',0		;DATA PROCESSING PRINT
LPI6	DB	ESC,'6',0		;6 LINES PER INCH		
LPI8	DB	ESC,'8',0		;8 LINES PER INCH
TURNUP	DB	CR,LF,'$'
;
;
; SIGN-ON MESSAGE
;
SOM	DB	LF,LF,LF,LF,LF,LF,LF,LF,LF,LF,LF,LF,LF
	DB	TAB,'OKIDATA 92A Printer options '
	DB	TAB,'12 March 84 CCR',LF,LF
	DB	CR,TAB,'STRING AS MANY NUMBERS AS YOU LIKE',LF
	DB	CR,TAB,TAB,'BEFORE YOU HIT A C/R',LF
	DB	CR,LF,TAB,TAB,'0 = DEFALT TO 10 CPI'
	DB	CR,LF,TAB,TAB,'1 = 5 CPI   Double Size '
	DB	CR,LF,TAB,TAB,'2 = 6 CPI   Double Size '
	DB	CR,LF,TAB,TAB,'3 = 8.5 CPI Double Size '
	DB	CR,LF,TAB,TAB,'4 = 10 CPI, Normal'
	DB	CR,LF,TAB,TAB,'5 = 12 CPI, Normal'
	DB	CR,LF,TAB,TAB,'6 = 17 CPI, Normal'
	DB	CR,LF,TAB,TAB,'7 = Correspondence Print'
	DB	CR,LF,TAB,TAB,'8 = Data Processing Print'
	DB	CR,LF,TAB,TAB,'9 = 6 Vertical lines per inch'
	DB	CR,LF,TAB,TAB,'A = 8 Vertical lines per inch'
	DB	CR,LF,LF,LF,LF,TAB,'Select: '
	DB	'$'
L_2	EQU	$
	CSEG
	ORG	Offset L_2
;
START:
	MOV	SP,(Offset STACK)	;SET UP STACK
	MOV	DX,(Offset SOM)		;SIGNON MESSAGE
	CALL	DSTRNG			;SHOW ON THE CRT
	MOV	BX,(Offset PRTSEL)	;SET THE PRINTER TO NORMAL CONDITIONS
	JMP	PSTRNG
;
SELECT:	CALL	INPUT			;GET A CHAR.
;
	CMP	AL,'0'			;RESET TO DEFAULT PARAMETERS
	MOV	BX,(Offset PRTSEL)	;TURN PRINTER ON and 10 CPI
	JNZ	L_3	
	JMP	PSTRNG
L_3:
;
	CMP	AL,'1'
	MOV	BX,(Offset CPI5)	; 5 CPI DOUBLE PRINT 
	JZ	PSTRNG
;                                                    
	CMP	AL,'2'
	MOV	BX,(Offset CPI6)	; 6 CPI DOUBLE PRINT 
	JZ	PSTRNG
;                                                    
	CMP	AL,'3'
	MOV	BX,(Offset CPI8)	; 8.5 CPDOUBLE PRINT 
	JZ	PSTRNG
;                                         
	CMP	AL,'4'
	MOV	BX,(Offset CPI10)	; 10 CPI, NORMAL
	JZ	PSTRNG
;                                         
	CMP	AL,'5'
	MOV	BX,(Offset CPI12)	; 12 CPI, NORMAL
	JZ	PSTRNG
;
	CMP	AL,'6'
	MOV	BX,(Offset CPI17)	; 17 CPI, NORMAL
	JZ	PSTRNG
;
	CMP	AL,'7'
	MOV	BX,(Offset CORA)	; CORRESPONDENCE PRINT
	JZ	PSTRNG
;
	CMP	AL,'8'
	MOV	BX,(Offset DATAP)	; DATA PROCESSING PRINT
	JZ	PSTRNG
;
	CMP	AL,'9'
	MOV	BX,(Offset LPI6)	; 6 VERTICAL LINES PER INCH
	JZ	PSTRNG
;
	CMP	AL,'A'
	MOV	BX,(Offset LPI8)	; 8 VERTICAL LINES PER INCH
	JZ	PSTRNG
;
	CMP	AL,'a'
	MOV	BX,(Offset LPI8)	; 8 VERTICAL LINES PER INCH
	JZ	PSTRNG
;
	JMPS	SELECT			;IF NONE OF THESE, ASK AGAIN
;                                                                      ;
;                     ROUTINES START HERE                              ;
;
EXIT:	MOV	DX,(Offset TURNUP)	;TURN UP SOME EXTRA LINES
	CALL	DSTRNG			;DISPLAY ON THE CRT
;
EXIT1:	MOV	CL,0			;FILLED BY 'START' FOR RETURN TO 'CCP'
	MOV	DL,0
	INT	BDOS
;
; GET A KEYBOARD CHARACTER
;
INPUT:	MOV	CL,CONIN		;KEYBOARD ROUTINE
	INT	BDOS
	AND	AL,7FH			;STRIP AWAY ANY PARITY
	CMP	AL,CTLC			;CONTROL-C?
	JZ	EXIT			;IF YES, ALL FINISHED
	CMP	AL,CR			;CONTROL-M FOR RETURN?
	JZ	EXIT			;IF YES, ALL FINISHED
	RET
;
; DISPLAY A STRING ON THE CRT
;
DSTRNG:	MOV	CL,STRING		;BDOS CONSOLE STRING ROUTINE
	INT	BDOS			;CALL BDOS AND SEND TO THE CRT
	RET
;
; PRINT A STRING OF CHARS. ON THE OKIDATA 92A
;
PSTRNG:	MOV	AL,M			;GET THE CHARACTER IN THE STRING
	OR	AL,AL			;SEE IF FINISHED YET
	JNZ	L_4	
	JMP	SELECT			;GET NEW ANSWER IF ZERO
L_4:
;
	PUSH	BX			;SAVE THE ADDRESS IN THE STRING
	MOV	CL,LST			;BDOS PRINTER ROUTINE
	MOV	DL,AL			;PUT THE CHAR. INTO 'E' REG.
	INT	BDOS			;CALL BDOS AND SEND TO THE PRINTER
	POP	BX			;BACK TO THE STRING ADDRESS
	INC	BX			;NEXT LOCATION
	JMPS	PSTRNG			;DO THE NEXT ONE
L_5	EQU	$
	DSEG
	ORG	Offset L_5
;
;
;	STACK AREA
;
	RS	20H			;ALLOW ROOM FOR STACK
L_6	EQU	$
	CSEG
	ORG	Offset L_6
;
STACK	RS	0			; "0" FOR GENCMD
;
	END
